import React from 'react';
import { proItem } from '@/types/home';
import { Image, Ellipsis } from 'antd-mobile';
import { Link, useNavigate } from 'react-router-dom';
type Props = {
    prolist: Array<proItem>
}

export default function Prolist(props: Props) {
    const navigate = useNavigate();
    return (
        <>
            <div className='prolistBox'>
                {props.prolist.map(item => {
                    return <div key={item.proid} className='proitem' onClick={() => {
                        navigate('/detail?proid=' + item.proid)
                    }}>
                        {/* <Link to={'/detail?id=' + item.proid}> */}
                        <Image src={item.img1}></Image>
                        <Ellipsis direction='end' rows={2} content={item.proname} />
                        <p>{item.originprice}</p>
                        {/* </Link> */}
                    </div>
                })}
            </div>


        </>
    )
}